package com.pet.server.po;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * PetAdopt entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "pet_adopt")
public class PetAdopt implements java.io.Serializable {

	// Fields

	private Integer adoptId;
	private Integer userId;
	private String petCate;
	private String city;
	private String area;
	private String sex;
	private Integer age;
	private String breed;
	private String icoPath;
	private Date createTime;
	private String phone;
	private String qq;
	private String description;
	private String nickName;
	private String state;
    private Integer count;
	
	// Constructors

	/** default constructor */
	public PetAdopt() {
	}

	/** minimal constructor */
	public PetAdopt(String petCate, String sex, Integer age, String breed) {
		this.petCate = petCate;
		this.sex = sex;
		this.age = age;
		this.breed = breed;
	}

	/** full constructor */
	public PetAdopt(Integer userId, String petCate, String sex, Integer age,String city,String area,
			String breed, String icoPath, Date createTime, String phone,
			String qq, String description) {
		this.userId = userId;
		this.petCate = petCate;
		this.sex = sex;
		this.city = city;
		this.area = area;
		this.age = age;
		this.breed = breed;
		this.icoPath = icoPath;
		this.createTime = createTime;
		this.phone = phone;
		this.qq = qq;
		this.description = description;
	}

	// Property accessors
	/**
	 * @return the adoptId
	 */
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "adopt_id", unique = true, nullable = false)
	public Integer getAdoptId() {
		return adoptId;
	}

	/**
	 * @param adoptId the adoptId to set
	 */
	public void setAdoptId(Integer adoptId) {
		this.adoptId = adoptId;
	}

	
	@Column(name = "user_id")
	public Integer getUserId() {
		return this.userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	@Column(name = "pet_cate", nullable = false, length = 20)
	public String getPetCate() {
		return this.petCate;
	}

	public void setPetCate(String petCate) {
		this.petCate = petCate;
	}

	@Column(name = "sex", nullable = false, length = 8)
	public String getSex() {
		return this.sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	@Column(name = "age", nullable = false)
	public Integer getAge() {
		return this.age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	@Column(name = "breed", nullable = false, length = 20)
	public String getBreed() {
		return this.breed;
	}

	public void setBreed(String breed) {
		this.breed = breed;
	}

	@Column(name = "ico_path", length = 128)
	public String getIcoPath() {
		return this.icoPath;
	}

	public void setIcoPath(String icoPath) {
		this.icoPath = icoPath;
	}

	@Column(name = "create_time", length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "phone", length = 20)
	public String getPhone() {
		return this.phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	@Column(name = "qq", length = 16)
	public String getQq() {
		return this.qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	@Column(name = "description", length = 256)
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the city
	 */
	@Column(name = "city", length = 16)
	public String getCity() {
		return city;
	}

	/**
	 * @param city the city to set
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * @return the area
	 */
	@Column(name = "area", length =32)
	public String getArea() {
		return area;
	}

	/**
	 * @param area the area to set
	 */
	public void setArea(String area) {
		this.area = area;
	}
	
	
    @Formula("(SELECT COUNT(1) FROM pet_adopt_item pai WHERE pai.adopt_id=adopt_id)")
	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

	 @Formula("(SELECT f.nick_name FROM user_info f WHERE f.user_id=user_id)")
	public String getNickName() {
		return nickName;
	}

	
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	@Column(name = "state", length = 128)
	public String getState() {
		return state;
	}

	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}
	
	
	
}